package com.thientan.controller

import com.thientan.model.HopDong
import com.thientan.service.InMaVachService
import com.thientan.utils.Utility

class InMaVachController extends HopDongController{
	InMaVachService inMaVachService

	@Override
	public Object getDomainService() {
		inMaVachService
	}

	@Override
	protected String getExportFileName(){
		"PhieuThuMaVach"
	}

	@Override
	protected Map buildExportData(Map exportParams){
		// Collect hopDong info to export Phieu Thu
		HopDong hopDong = HopDong.get(params['id'])
		String maHd = hopDong ? hopDong.maHd : ""
		
		// Generate barcode
		String barcodePath = "${realPath}exported${slash}barcode${maHd}.gif"
		Utility.generateBarcode(maHd, barcodePath)
		
		['data' : [], 'mavachpath' : barcodePath]
	}
}